import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/admin/home'
    },
    {
      path: '/login',
      name: 'login',
      component: resolve => require(['@/pages/login'], resolve)
    },
    {
      path: '/admin',
      name: 'admin',
      component: resolve => require(['@/admin'], resolve),
      children: [
        {
          path: '/admin/home',
          name: 'home',
          component: resolve => require(['@/pages/home'], resolve)
        },
        {
          path: '/admin/addCard',
          name: 'addCard',
          component: resolve => require(['@/pages/addCard'], resolve)
        },
        {
          path: '/admin/addCard/add',
          name: 'addCardAdd',
          component: resolve => require(['@/pages/addCard/add'], resolve)
        },
        {
          path: '/admin/financial',
          name: 'financial',
          component: resolve => require(['@/pages/financial'], resolve)
        },
        {
          path: '/admin/merchant',
          name: 'merchant',
          component: resolve => require(['@/pages/merchant'], resolve)
        },
        {
          path: '/admin/online',
          name: 'online',
          component: resolve => require(['@/pages/online'], resolve)
        },
        {
          path: '/admin/operate',
          name: 'operate',
          component: resolve => require(['@/pages/operate'], resolve)
        }
      ]
    }
  ]
})
